package com.lwg.datastructure.commonSortingAlgorithm;

/**
 * @author: lwg
 * @Date: 2022/4/22 22:24
 * @Description: 递归
 */
public class Recursion {
    public static void main(String[] args) {
        System.out.println(f(4));
    }
    
    public static long f(int n) {
        if (n < 1) {
            return -1;
        }
        if (n == 1) {
            return 1;
        }
        return n + f(n - 1);
    }
    
}
